package com.pkk.cloud.support.admin.oauth2.api.admin;

import static com.pkk.cloud.support.admin.oauth2.api.admin.AdminApi.CLOUD_SUPPORT_ADMIN;

import com.pkk.cloud.support.admin.oauth2.api.common.req.PenguinModifyPasswordReq;
import com.pkk.cloud.support.admin.oauth2.api.common.req.PenguinSysUserIdReq;
import com.pkk.cloud.support.admin.oauth2.api.common.req.PenguinSysUserNameReq;
import com.pkk.cloud.support.admin.oauth2.api.common.resp.PenguinSysUserInfo;
import com.pkk.cloud.support.admin.oauth2.api.common.resp.PenguinSysUserAuthorizeResp;
import com.pkk.cloud.support.admin.oauth2.api.config.FeignConfiguration;
import com.pkk.components.rpc.request.CommonRequest;
import com.pkk.components.rpc.response.CommonResponse;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;

/**
 * @description: admin的资源相关接口
 * @author: peikunkun
 * @create: 2020-03-18 13:35
 **/
@FeignClient(name = CLOUD_SUPPORT_ADMIN, configuration = FeignConfiguration.class, path = "/api/", fallback = AdminApiHystrix.class)
public interface AdminApi {

  /**
   * admin项目的接口
   */
  String CLOUD_SUPPORT_ADMIN = "cloud-support-admin";

  /**
   * @Description: 获取用户信息
   * @Author: peikunkun
   * @Date: 2020/03/18 10:16
   */
  @RequestMapping(value = "loadUserByUsername", method = RequestMethod.POST)
  CommonResponse<PenguinSysUserInfo> loadUserByUsername(@RequestBody CommonRequest<PenguinSysUserNameReq> request);

  /**
   * @Description: 获取授权用户
   * @Author: peikunkun
   * @Date: 2020/03/18 10:18
   */
  @RequestMapping(value = "getAuthorize", method = RequestMethod.POST)
  CommonResponse<PenguinSysUserAuthorizeResp> getAuthorize(@RequestBody CommonRequest<PenguinSysUserIdReq> request);

  /**
   * @Description: 修改密码
   * @Author: peikunkun
   * @Date: 2020/03/18 10:18
   */
  @RequestMapping(value = "modifyUserPwd", method = RequestMethod.POST)
  CommonResponse<?> modifyUserPwd(@RequestBody CommonRequest<PenguinModifyPasswordReq> request);


}
